

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>短信设置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media= "all">
    <link rel="stylesheet" href="/Font-Awesome-master/css/font-awesome.min.css">
    <link rel="stylesheet" href="/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <script src="/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
    <script src="/js/jquery-2.1.1.min.js"></script>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">控制器生成</div>
                <div class="layui-card-body" pad15>

                    <div class="layui-form" wid100 lay-filter="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">控制器名称</label>
                            <div class="layui-input-inline">
                                <input id="controller" type="text" name="controller"  value="" lay-verify="required" placeholder="请输入控制器名称" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">模块</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="modular" value="admin" title="后台" checked>
                                <input type="radio" name="modular" value="api" title="接口(不会生成视图)" >
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">模型生成</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="model" value="1" title="是" checked>
                                <input type="radio" name="model" value="2" title="否" >
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">视图生成</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="view" value="1" title="是" checked>
                                <input type="radio" name="view" value="2" title="否" >
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="set_website">确定生成</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.config({
        base: '/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form'],function(){
        var $ = layui.$
            ,layer = layui.layer
            ,form = layui.form
        //设置我的资料
        form.on('submit(set_website)', function(obj){
            //提交修改
            console.log(obj.field);
            $.ajax({
                'url': "{:url('add_ajax')}",
                'method': 'POST',
                'data': obj.field,
                'success': function (res) {
                    if (res.code == 200) {
                        $("#controller").val('');
                        layer.msg('生成成功！');
                    } else {
                        $("#controller").val('');
                        layer.msg(res.message);
                    }
                },
                'error':function(){
                    layer.msg('接口异常');
                }
            });
            return false;
        });
    });
</script>
</body>
</html>